import java.util.*;
public class lk6278 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=121;
        System.out.println(countDigits(n));
        
    }
    public static int countDigits(int num) {
        int n=num,count=0,c=0;
        while(n!=0){
            c=n%10;
            if(num%c==0){
                count++;
            }
            n=n/10;
        }
        return count;
    }
}

